#ifndef CLIENTLIST_H_
#define CLIENTLIST_H_

#include "../common/common.h"

typedef struct _client_t{
	int port_c;
	int port_s;
	int isclient;
	char ip[TAILLE_IP];
	int socket;
	clock_t last_event;
}client_t;

typedef client_t * client_p;

typedef struct elementclient{
	client_p data;
	struct elementclient *next;
	struct elementclient *previous;
}elementclient;

typedef struct clientlist{
	elementclient *first;
	elementclient *last;
	u_int size;
}clientlist_t;

typedef clientlist_t * clientlist_p;

clientlist_p clientlist_new(void);
void clientlist_init(clientlist_p list);
return_t clientlist_insert(clientlist_p list, client_p dataclient);
return_t clientlist_remove(clientlist_p list, client_p dataclient);
return_t clientlist_clear(clientlist_p list);
void clientlist_delete(clientlist_p list);
void clientlist_print(clientlist_p list);
client_p findBySocket(int socket, clientlist_p list);
int checkClientExist(clientlist_p list,client_p client);

#endif /* CLIENTLIST_H_ */
